﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MLY.Reports
{
    public partial class AdvReportsViewer : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ReportLiteral.Text = "<iframe id=\"iframe1\" src=\"" + ReadReportName() + "\"  style=\"width:100%;\" onLoad=\"autoResize('iframe1');\"  > </iframe>";
        }
        private string ReadReportName()
        {
            string ReportName = "../LTR/ExceptionsProcessReport.aspx";
            string userRole = SessParam.IsClient ? "Client" : "Contructor";

            if (Request.QueryString["ReportName"] != null)
            {
                string qs = Request.QueryString["ReportName"];
                switch (qs)
                { 
                    case "ExceptionsProcessReport":
                        ReportName = "../LTR/ExceptionsProcessReport.aspx";
                        break;
                    case "ApprovedMaterials":
                        ReportName = "../LTR/ApprovedMaterialsInProcess.aspx";
                        break;
                    case "TPTRawData":
                        ReportName = "../LTR/TPTRawDataView.aspx";
                        break;
                    case "StepTimeDeviationSpecial":
                        ReportName = "../Reports/ChartReports/DataFlowReport_Special.aspx";
                        break;
                    case "OpenLinesWithoutMaterial":
                        ReportName = "../Reports/DataReports/ExceptionsReportNoWithoutActual.aspx";
                        break;
                    case "SystemErrors":
                        ReportName = "../Reports/DataReports/ErrorsLog.aspx";
                        break;
                    case "StepTimeDeviation":
                        ReportName = "../Reports/ChartReports/DataFlowReport.aspx?userRole=" + userRole; 
                        break;
                    case "MissingParts":
                        ReportName = "../Reports/DataReports/MissingPartsReport.aspx";
                        break;
                    case "BulkUpdate":
                        ReportName = "../LTR/BulkUpdate2.aspx";
                        break;
                    case "OrdersByDates":
                        ReportName = "../Reports/DataReports/WorkOrderByDateReport.aspx";                    
                        break;
                    case "OpenOrders":
                        ReportName = "../Reports/DataReports/OpenOrdersInventoryReport.aspx?userRole=" + userRole;                   
                        break;
                    case "LateOrders":
                        ReportName = "../Reports/DataReports/LateOrdersReport.aspx?userRole=" + userRole;
                        break;
                    case "RelatedOrganizationsSummary":
                        ReportName = "../Reports/DataReports/RelatedOrganizationsSummary.aspx";
                        break;
                    case "CanceledWorkOrders":
                        ReportName = "../Reports/DataReports/CanceledOrdersReport.aspx";
                        break;
                    case "DeadInventory":
                        ReportName = "../Reports/SCCoverReports/DeadInventoryReport.aspx?userRole=" + userRole;
                        break;
                    case "OpenAlerts":
                        ReportName = "../Reports/SCCoverReports/OpenUserAlerts.aspx";
                        break;
                    case "MissingOrders":
                        ReportName = "../Reports/SCCoverReports/MissingOrdersReport.aspx";
                        break;
                    case "LastOrder":
                        ReportName = "../Reports/SCCoverReports/LastOrderReport.aspx";
                        break;
                    case "RowMaterialControl":
                        ReportName = "../Reports/DataReports/RowMaterialInventoryControlReport.aspx";
                        break;
                    case "DisqualifyReasons":
                        ReportName = "../Reports/ChartReports/DisqualifyReasonsReport.aspx";
                        break;
                    case "MaterialInQC":
                        ReportName = "../Reports/DataReports/MaterialInQCReport.aspx";
                        break;
                    case "OTDYield":
                        ReportName = "../Reports/DataReports/OtdYieldReport.aspx";
                        break;
                    case "DeliveryDispatch":
                        ReportName = "../Reports/DataReports/DeliveryDispatch.aspx?ReportType=DeliveryDispatch";
                        break;
                    case "OpenMaterial":
                        ReportName = "../Reports/DataReports/DeliveryDispatch.aspx?ReportType=OpenMaterial";
                        break;
                    case "FutureInventory":
                        ReportName = "../Reports/DataReports/DeliveryDispatch.aspx?ReportType=FutureInventory";
                        break;
                    default:
                        ReportName = "../LTR/ExceptionsProcessReport.aspx";
                        break;
                }
            }
            return ReportName;
        }
    }
}
